#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int findPeakElement(vector<int>& nums)
    {
        int left = 0, rigth = nums.size() - 1;
        while (left < rigth)
        {
            int mid = left + (rigth - left + 1) / 2;
            if (nums[mid - 1] < nums[mid]) left = mid;
            else rigth = mid - 1;
        }
        return left;
    }
};